package ModelLayer;
import java.util.ArrayList;


/**
 * Handles the Person objects
 * 
 * @author Malte, Jimmi
 * @version 1.0 (2013-11-06)
 */
public class Person
{
    private static long id = 0;
    private long currentId;
    private String name;
    private String address;
    private String postalCode;
    private String city;
    private String phone;
    private ArrayList<Borrow> lendingList;
    
    /**
     * Constructor for objects of class Person
     */
    public Person(String name, String address, String postalCode, String city, String phone)
    {
        id++;
        currentId = id;
        this.name = name;
        this.address = address;
        this.postalCode = postalCode;
        this.city = city;
        this.phone = phone;
        lendingList = new ArrayList<Borrow>();
    }

    /**
     * set name to a new String.
     * 
     * @param name The new String .
     */
    public void setName(String name)
    {
        this.name = name;
    }
    
    /**
     * set address to a new String. 
     * 
     * @param address The new String. 
     */
    public void setAddress(String address)
    {
        this.address = address;
    }
    
    /**
     * set postalCode to a new String.
     * 
     * @param postalCode The new String.
     */
    public void setPostalCode(String postalCode)
    {
        this.postalCode = postalCode;
    }
    
    /**
     * set city to a new String.
     * 
     * @param city The new String.
     */
    public void setCity(String city)
    {
        this.city = city;
    }
    
    /**
     * sets phone to a new String.
     * 
     * @param phone the new String.
     */
    public void setPhone(String phone)
    {
        this.phone = phone;
    }
    
    /**
     * Get ID
     * @return ID
     */
    
    public long getId()
    {
        return currentId;
    }
    
    /**
     * Get Name
     * @return name
     */
    public String getName()
    {
        return name;
    }
    
    /**
     * Get Address
     * @return Address
     */
    public String getAddress()
    {
        return address;
    }
    
    /**
     * Get PostalCode
     * @return Postal Code
     */
    public String getPostalCode()
    {
        return postalCode;
    }
    
    /**
     * Get City
     * @return city
     */
    public String getCity()
    {
        return city;
    }
    
    /**
     * Get Phone
     * @return Phonenumber
     */
    public String getPhone()
    {
        return phone;
    }
    
    /**
     * Returns the lendingList ArrayList
     * 
     * @return ArrayList lendingList
     */
    public ArrayList loans()
    {
        return lendingList;
    }
    
    /**
     * Adds a Borrow object to the ArrayList lendingList
     * 
     * @param p dvd object
     */
    public void addLoan(Borrow loan)
    {
        lendingList.add(loan);
    }
    
    /**
     * Remove a Borrow object from the ArrayList
     * @param specimen Dvdspecimen object 
     */
    public void deleteLoan(DvdSpecimen specimen)
    {
        lendingList.remove(specimen);
    }
    
    /**
     * Retuns a Borrow object
     * @param index index
     * @return A Borrow object
     */
    public Borrow getLoan(int index)
    {
        return lendingList.get(index);
    }
    
}
